package mof.gov.dmdc.view.backing.lov;

import mof.gov.dmdc.view.common.Common;

import oracle.adf.view.rich.component.rich.input.RichInputText;

import org.apache.myfaces.trinidad.event.ReturnEvent;

public class BrowseLov {
    private RichInputText lovIt;

    public BrowseLov() {
        super();
        this.lovIt = new RichInputText();
    }


    public void lovDialogReturnListener(ReturnEvent returnEvent) {
        String isSelected;
        try {
            isSelected = Common.getFromPageFlowScope("isSelected").toString();
        } catch (NullPointerException e) {
            isSelected = "";
        }
        if (isSelected.equalsIgnoreCase("true")) {
            String selectedValue = Common.getFromPageFlowScope("selectedValue").toString();
            lovIt.resetValue();
            lovIt.setValue(selectedValue);
            Common.refreshComponent(lovIt);
        }
    }

    public void setLovIt(RichInputText lovIt) {
        this.lovIt = lovIt;
    }

    public RichInputText getLovIt() {
        return lovIt;
    }

}
